<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../js/css.js"></script>
    <link rel="stylesheet" href="../css/mui.min.css">
    <link rel="stylesheet" href="../css/style-zj.css">
    <link rel="stylesheet" href="../css/hzy.css">
    <script src="../layer_mobile/layer.js"></script>
</head>
<body class="">
<header><a class="icon_back"></a>云家故事</header>
<div class="head_height"></div>
<div class="progress pt_20" id="choose-time" v-cloak>
    <div class="date get-time">
        <div class="title-timeshow"></div>
        <div class="box-week">
            <div class="item c-999">日</div>
            <div class="item c-999">一</div>
            <div class="item c-999">二</div>
            <div class="item c-999">三</div>
            <div class="item c-999">四</div>
            <div class="item c-999">五</div>
            <div class="item c-999">六</div>
        </div>
        <div class="box-week">
            <div class="item js-chooseday" v-for="item in dayList">
                <span class="span1">{{item.day}}</span>
                <span class="span2 hide">{{item.weekday}}</span>
            </div>
        </div>
    </div>
    <div class="choose hide js-showbox">
        <p class="time">拍摄时间</p>
        <div class="btn-choose">
            <div class="item js-choosetime" v-for="item in timeList">
                <span class="no-select"></span>
                <span class="time-show1">{{item.time}}</span>
            </div>
            <!--<div class="item">-->
                <!--<span class="yes-select">✔</span>-->
                <!--<span class="time-show2">9:30</span>-->
            <!--</div>-->
        </div>
    </div>
    <div class="choose hide js-showbox">
        <p class="time mart-20">已选档期</p>
        <div class="time-detail font-19 js-seldTime">

        </div>
    </div>
    <a class="btn-go js-submit">确定</a>
    <div class="phone-text"><span class="color-a8 marr-32">预约其他时间请致电客服！</span><i class="phone-icon icon-top2 top-2"></i>
    </div>
</div>
</body>
<script src="../js/mui.min.js"></script>
<script src="../js/config.js"></script>
<script>
    var myDate = new Date();//获取系统当前时间
    var storeId = getUrlParam("storeId");
    var snId = getUrlParam("snId");
    var upgradeIds = getUrlParam("upgradeIds");
    var productId = getUrlParam("productId");
    var year = myDate.getFullYear();
    var month = myDate.getMonth()+1;
    var chooseDay = '';
    var chooseTime = '';
    var orderId = getUrlParam("orderId");

    $('.title-timeshow').html(year+'年'+month+'月');
    $('.js-seldTime').html(year+'年'+month+'月')

//    mui.init()

    var app = new Vue({
        el:'#choose-time',
        data:{
            dayList:[],
            timeList:[]
        },
        mounted:function(){
            get_ajax("order/getScheduleTime", {storeId:storeId,year:year,month:month}, function (data) {
                app.dayList = data.dateArray;
                app.timeList = data.list;
            });
        },
        methods:{

        },

    })

    var wek = '';
    $(document).on('click','.js-chooseday',function(){
        $('.js-showbox').removeClass('hide');
        $(this).find('span').addClass('selected-sty1');
        $(this).siblings().find('span').removeClass('selected-sty1');
        chooseDay = $(this).find('.span1').html();
        wek = $(this).find('.span2').html();
        $('.js-seldTime').html(year+'年'+month+'月'+chooseDay+'日('+wek+')'+chooseTime)
    })
    $(document).on('click','.js-choosetime',function(){
        $(this).find('span:first-child').addClass('yes-select');
        $(this).siblings().find('span:first-child').removeClass('yes-select');
        chooseTime = $(this).find('.time-show1').html();
        console.log(chooseTime)
        $('.js-seldTime').html(year+'年'+month+'月'+chooseDay+'日('+wek+')'+chooseTime)
    })

    $('.js-submit').on('click',function(){
        if(chooseDay&&chooseTime){
            var shootTime = year+'-'+(month<10?"0"+month:month)+'-'+(chooseDay<10?"0"+chooseDay:chooseDay)+" "+chooseTime+":00";
            var sendData = {
                orderId:orderId,
                shootTime:shootTime,
                token:token,
            };
            get_ajax("order/setSchedule",sendData,function (data) {
                mui.alert('排期成功！', '提示', function() {
                    history.go(-1);
                });

            });
        }else{
            layer.open({
                content: '请选择日期和时间'
                ,skin: 'msg'
                ,time: 1
            });
        }
    })

</script>
</html>